import numpy as n
import pyfits as p
import wcsutil
from xml.dom import minidom

class kmlobject(object):
    def __init__(self,rootname):
        wcsobj = wcsutil.WCSObject(rootname,header=None,shape=None,\
                                   pa_key=None,new=True,prefix=None)
        self.wcs = wcsobj
    
    def __str__(self):
        tmp = wcsutil.WCSObject.__str__(self.wcs)
        return tmp
    
    def getcrval(self):
        return self.wcs.crval1
    def setcrval(self,newCRVAL):
        self.wcs.crval1 = newCRVAL
    crval = property(getcrval,setcrval,None,"CRVAL for WCS object.")

    def getcrpix(self):
        return self.wcs.crpix1
    def setcrpix(self,newCRPIX):
        self.wcs.crpix1 = newCRPIX
    crpix = property(getcrpix,setcrpix,None,"CRPIX for WCS object.")
    
    def getcdmatrix(self):
        return (self.wcs.cd11,self.wcs.cd12,self.wcs.cd21,self.wcs.cd22)
    def setcdmatix(self,newcd):
        self.wcs.cd11 = newcd[0]
        self.wcs.cd12 = newcd[1]
        self.wcs.cd21 = newcd[2]
        self.wcs.cd22 = newcd[3]
    cdmatrix = property(getcdmatrix,setcdmatix,None,"CD matrix for WCS object.  Get/Set expressed as tuple.")
    
        
    def getcd11(self):
        return self.wcs.cd11
    def setcd11(self,newcd11):
        self.wcs.cd11 = newcd11
    cd11 = property(getcd11,setcd11,None,"CD11 matrix value for WCS object.")
    
    def getcd12(self):
        return self.wcs.cd12
    def setcd12(self,newcd12):
        self.wcs.cd12 = newcd12
    cd12 = property(getcd12,setcd12,None,"CD12 matrix value for WCS object.")
    
    def getcd21(self):
        return self.wcs.cd21
    def setcd21(self,newcd21):
        self.wcs.cd21 = newcd21
    cd21 = property(getcd21,setcd21,None,"CD21 matrix value for WCS object.")
    
    
    def getcd22(self):
        return self.wcs.cd22
    def setcd22(self,newcd22):
        self.wcs.cd22 = newcd22
    cd22 = property(getcd22,setcd22,None,"CD22 matrix value for WCS object.")
    
    def getpscale(self):
        return self.wcs.pscale
    def setpscale(self,newpixscale):
        self.wcs.pscale = newpixscale
    pscale = property(getpscale,setpscale,None,"PSCALE value for WCS object.")
    

 

